$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_yjhjf_m")
    const dgrid1 = $NG.getCmpApi("")
    const getHeadValue = (str) => mstform.getItem(str).getValue()
            hideKeys()
    useValuesChange(() => {
        getXmkInfoByPhid()
    }, "p_form_yjhjf_m.u_xmmc")

    useValuesChange(() => {
        hideKeys()
    }, "p_form_yjhjf_m.u_sffzxyj")

    // 获取项目库信息
    function getXmkInfoByPhid() {
        const phid = getHeadValue("u_xmmc")
        if (!phid) return
        $NG.execServer("getXmkInfoByPhid", { phid }, (res) => {
            if (res.count == 0) return
            const datas = JSON.parse(res.data)[0].extendObjects
            $NG.updateState((updater) => {
                updater.data.p_form_yjhjf_m.setProps({
                    bill_no: datas.u_xmbh,
                    u_gctze: datas.u_ztzje,
                })
            })
        })
    }

    // 吟唱
    function hideKeys() {
        const phid = getHeadValue("u_sffzxyj")
        let hidden = ''
        if (phid == '01') {
            hidden = 'tabPanel_tabItem'
        }
        const tabs = $NG
            .getCompMap()
            .get("__Tabs__")[0]
            .getApi();

        tabs.updateItems((innerItems, activeKey) => {
            return [...innerItems.filter((item) => {
                if (item.name == hidden) {
                    return item
                }
            })];
        });
    }
})
